package com.ruoyi.goods.GoodsStore.domain;

import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.*;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ruoyi.common.core.domain.BaseEntity;

import java.util.List;

/**
 * 物品分类信息对象 goods_category
 *
 * @author yl
 * @date 2022-11-27
 */
@Getter
@Setter
@ToString
@TableName("goods_category")
public class GoodsCategory extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** $column.columnComment */
    @TableId(type = IdType.AUTO)
    @TableField("id")
    private Long id;

    /** 分类名称 */
    @Excel(name = "分类名称")
    @TableField("category_name")
    private String categoryName;

    /** 描述 */
    @Excel(name = "描述")
    @TableField("category_desc")
    private String categoryDesc;

    /** id层级结构 */
    @Excel(name = "id层级结构")
    @TableField("busi_path")
    private String busiPath;

    /** 上级分类id */
    @Excel(name = "上级分类id")
    @TableField("parent_id")
    private Long parentId;

    /** 关键字 */
    @TableField(exist = false)//忽略字段
    private String keyword;

    /** 子类集合 */
    @JsonInclude(JsonInclude.Include.NON_EMPTY)//当children为空时不返回数据
    @TableField(exist = false)
    private List<GoodsCategory>children;

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("categoryName", getCategoryName())
            .append("categoryDesc", getCategoryDesc())
            .append("busiPath", getBusiPath())
            .append("parentId", getParentId())
            .toString();
    }
}
